<?php $this->renderPartial('_tabs'); ?>
<div class="grid_16">
    <div class="admin-agency form">
		<?php
		$form = $this->beginWidget('CActiveForm', array(
			'id' => 'admin-agency-mls-form',
			'enableAjaxValidation' => false,
			'htmlOptions' => array()
		));
		?>
        <div class="section">
			<div class="block">
				<div class="table-block">
					<table class="form-table">
						<?php if (!empty($property)): ?>
							<?php $i = 0; ?>
							<?php foreach ($property->attributes as $key => $value): ?>
								<?php
								if (in_array($key, $property_exception_list))
									continue;
								?>
								<?php if ($i % 2 == 0): ?>
									<tr>
									<?php endif; ?>
									<?php $active = Yii::app()->user->model->agency->getAttributeActiveStatusBySetting(get_class($property), $key);?>
									<td id='<?php echo strtolower(get_class($property)) . "-" . $key; ?>' class="<?php echo ($active == '1' || $active) ? "" : "inactive"; ?>"><?php echo $property->getAttributeLabel($key) ?></td>
									<td class="<?php echo ($active == '1' || $active) ? "" : "inactive"; ?>"><a class='setting'><img src="/images/icons/fugue/pencil.png"  alt='<?php echo get_class($property) . "." . $key; ?>'/>Edit</a></td>
									<?php $i++; ?>
									<?php if ($i % 2 == 0): ?>
									</tr>
									<?php $i = 0; ?>
								<?php endif; ?>
							<?php endforeach; ?>
							<?php
							if ($i % 2 != 0) {
								echo "<td clospan='2'></td>";
								echo "</tr>";
							}
							?>
						<?php endif; ?>
					</table>
				</div>
			</div>
		</div>
		<?php $this->endWidget(); ?>
	</div>
</div>

<div id="attr-setting-form">
	<?php
	$form = $this->beginWidget('PsActiveForm', array(
		'id' => 'property-attr-setting-form',
		'action' => array('/ajax/agency/updateSetting/', 'model_name' => get_class($property)),
		'enableAjaxValidation' => false,
		'enableClientValidation' => true,
		'clientOptions' => array(
			'inputContainer' => 'tr',
			'validationDelay' => 0,
			'validateOnSubmit' => true,
	)));
	?>	
	<table width="100%" cellspacing="0" cellpadding="5" border="0" class="small">												
		<tbody>
			<tr>
				<td width="10px" valign="top" align="left">
					<input type='hidden' value='0' name='AgencySetting[setting][active]'>
					<input type='checkbox' value='1' name='AgencySetting[setting][active]'>
					<?php // echo CHtml::hiddenField("AgencySetting[setting][active]", '0'); ?>
					<?php // echo CHtml::checkBox("AgencySetting[setting][active]", "checked", array('value' => '1')); ?>
				</td>
				<td valign="top" align="left">	
					&nbsp;Active
					<?php echo CHtml::hiddenField("AgencySetting[setting][attribute]", ""); ?>
				</td>
			</tr>
			<tr>
				<td width="10px" valign="top" align="left">
					<input type='hidden' value='0' name='AgencySetting[setting][label_changed]'>
					<input type='checkbox' value='1' name='AgencySetting[setting][label_changed]'>
					<?php // echo CHtml::checkBox("AgencySetting[setting][label_changed]", ""); ?>
				</td>
				<td valign="top" align="left">	
					&nbsp; Default Label
					<?php echo CHtml::textField("AgencySetting[setting][default_label]", ""); ?>
				</td>
			</tr>
			<tr>
				<td width="10px" valign="top" align="left">
					<input type='hidden' value='0' name='AgencySetting[setting][default_value_changed]'>
					<input type='checkbox' value='1' name='AgencySetting[setting][default_value_changed]'>
					<?php // echo CHtml::checkBox("AgencySetting[setting][default_value_changed]", ""); ?>
				</td>
				<td valign="top" align="left">	
					&nbsp; Default Value
					<?php echo CHtml::textField("AgencySetting[setting][default_value]", ""); ?>
				</td>
			</tr>
		</tbody>
	</table>
	<?php $this->endWidget(); ?>
</div>
